Received: by mail3.netcom.com (8.6.9/Netcom) id PAA10901; Tue, 23 Aug 1994 15:55:32 -0700
Received: from gwha.com by mail3.netcom.com (8.6.9/Netcom) id PAA10827; Tue, 23 Aug 1994 15:54:58 -0700
Received: from kong.gwha.com (kong.gwha.com [192.231.139.38]) by gwha.com (8.6.5/8.6.5) with SMTP id WAA15461 for <@gwha.com:lightwave-l@netcom.com>; Tue, 23 Aug 1994 22:14:33 GMT
Received: by kong.gwha.com (931110.SGI/930416.SGI.AUTO) for @gwha.com:lightwave-l@netcom.com id AA01375; Tue, 23 Aug 94 16:14:31 -0600
From: "Chris Hurtt" <chris@kong.gwha.com>
Message-Id: <9408231614.ZM1373@kong.gwha.com>
Date: Tue, 23 Aug 1994 16:14:28 -0600
X-Mailer: Z-Mail (3.1.0 22feb94 MediaMail)
To: lightwave-l@netcom.com
Subject: LW Object File Format
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Sender: owner-lightwave-l@netcom.com
Precedence: bulk
Reply-To: lightwave-l@netcom.com
A little later than planned but as promised:
LIGHTWAVE 3D OBJECT FILE FORMAT
by Allen Hastings
revised 11/10/93
Introduction
LightWave 3D objects are stored as IFF files with a FORM type of
LWOB. Currently, a FORM LWOB must contain a PNTS chunk, a SRFS
chunk, and a POLS chunk (in that order). These may be followed by
zero or more SURF chunks. LightWave 2.0 also has the ability to
save and load surface descriptions as FORM LWOB files that contain
only a SURF chunk.
This document explains the contents of each chunk and includes an
annotated listing of a FORM LWOB as an example.
PNTS Chunk
This chunk contains a list of the X, Y, and Z coordinates of all
the points in an object. Each coordinate is stored as a four byte
floating point number in IEEE format. Therefore, the number of
points in an object can be determined by dividing the size in bytes
of the PNTS chunk by 12.
By convention, the +X direction is to the right or east, the +Y
direction is upward, and the +Z direction is forward or north.
For models of real-world objects, the unit size is usually
considered to be one meter. The coordinates are specified relative
to an object's pivot point. See the LightWave Modeler manual for
more information about LightWave 3D's geometric conventions.
SRFS Chunk
This chunk contains a list of the names of all the surfaces in an
object (note that in LightWave 3D terminology, the word "surface"
is defined as a set of attributes that describe the color and
shading characteristics of a group of polygons). Each surface name
appears as a null-terminated character string. If the length of
the string (including the null) is odd, an extra null byte is
added. Surface names should be read from the file until as many
bytes as the chunk size specifies have been read.
POLS Chunk
This chunk contains a list of all the polygons in an object. Each
entry consists of a short integer specifying the number of vertices
in a polygon followed by that many short integers specifying the
vertices themselves (as indices into the points list) followed by a
short integer specifying which surface is used by the polygon (as
an index into the surfaces list). The number of vertices in a
polygon currently may vary from one to 200. The vertex list for
each polygon should begin at a convex vertex and proceed clockwise
as seen from the visible side of the polygon (LightWave 3D polygons
are single-sided, except for those whose surfaces have the double-
sided flag set). The points list in the PNTS chunk is numbered
starting with zero and the surfaces list in the SRFS chunk is
numbered starting with one (so that surface numbers can be made
negative to signal the presence of detail polygons as explained
below). Polygons should be read from the file until as many bytes
as the chunk size specifies have been read.
A negative surface number for a polygon indicates that the polygon
has detail polygons (which are drawn on top of the main polygon and
may be coplanar with it). In this case, the next number in the
file is a short integer specifying how many detail polygons belong
to the current polygon. This is followed by a list of those detail
polygons, where each entry is of the same format as described above
for regular polygons (except that the detail polygons cannot have
details of their own). The list of regular polygons then resumes.
To determine which surface is used by a polygon with a negative
surface number, the absolute value of that number should be used.
SURF Chunks
Each SURF chunk describes the surface attributes of a particular
surface. These chunks begin with the name of the surface being
described. The name is stored as a character string with either
one or two trailing nulls (as explained in the SRFS chunk section).
Following the name is a series of sub-chunks, which are like normal
IFF chunks except that their sizes are specified by short integers
instead of longs. It is likely that the variety of sub-chunks will
grow as new surface attributes are added to the program, but any
unknown sub-chunks may be skipped over in the usual IFF fashion.
Sub-chunks should be read from the file until as many bytes as the
chunk size specifies have been read.
COLR Sub-Chunk
This sub-chunk consists of three bytes that specify the red,
green, and blue color components of the current surface, followed
by a byte which is currently ignored and should be zero. A
surface can therefore be any of 16,777,216 possible colors.
FLAG Sub-Chunk
This sub-chunk contains a short integer whose bits specify
various options for the current surface. Currently only the
nine least significant bits are used. The options that set bits
indicate are (starting with the least significant bit):
Luminous, Outline, Smoothing, Color Highlights, Color Filter,